import moment from 'moment';

const phenomenaOption = {
  title: {
    text: '不良现象',
    left: 'center'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {
    top: '5%',
    data: ['数量', '累计占比']
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'category',
    data: []
  },
  yAxis: [
    {
      type: 'value',
      name: '数量',
      position: 'left',
      alignTicks: true,
      axisLine: {
        show: true,
        lineStyle: {
          color: ['#63b2ee']
        }
      }
    },
    {
      type: 'value',
      name: '累计占比',
      position: 'right',
      alignTicks: true,
      axisLine: {
        show: true,
        lineStyle: {
          color: ['#80dd99']
        }
      },
      axisLabel: {
        formatter: '{value} %'
      }
    }
  ],
  series: [
    {
      name: '数量',
      type: 'bar',
      barWidth: 20,
      yAxisIndex: 0,
      data: []
    },
    {
      name: '累计占比',
      type: 'line',
      yAxisIndex: 1,
      data: []
    }
  ]
};
const reasonOption = {
  title: {
    text: '不良原因',
    left: 'center'
  },
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {
    top: '5%',
    data: ['数量', '累计占比']
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: {
    type: 'category',
    data: []
  },
  yAxis: [
    {
      type: 'value',
      name: '数量',
      position: 'left',
      alignTicks: true,
      axisLine: {
        show: true,
        lineStyle: {
          color: ['#63b2ee']
        }
      }
    },
    {
      type: 'value',
      name: '累计占比',
      position: 'right',
      alignTicks: true,
      axisLine: {
        show: true,
        lineStyle: {
          color: ['#80dd99']
        }
      },
      axisLabel: {
        formatter: '{value} %'
      }
    }
  ],
  series: [
    {
      name: '数量',
      type: 'bar',
      yAxisIndex: 0,
      barWidth: 20,
      data: []
    },
    {
      name: '累计占比',
      type: 'line',
      yAxisIndex: 1,
      data: []
    }
  ]
};
const tableOption = {
  border: true,
  addBtn: false,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  index: true,
  menu: true,
  columnBtn: false,
  refreshBtn: false,
  indexLabel: '序号',
  column: [
    {
      label: '工单号',
      prop: 'workOrderNo'
    },
    {
      label: '产品名称',
      prop: 'partName'
    },
    {
      label: '产品编码',
      prop: 'partNo'
    },
    {
      label: '进不良日期',
      prop: 'registryDate',
      formatter: (row, value, label, column) => {
        return moment(value).format('yyyy-MM-DD');
      }
    },
    {
      label: '不良工序名称',
      prop: 'fromRouteName'
    },
    {
      label: '数量',
      prop: 'ngQuantity'
    },
    {
      label: '批次',
      prop: 'workLotNo',
      span: 6
    },
    {
      label: '机型',
      prop: 'workProductModel',
      span: 6
    }
  ]
};
const detailOption = {
  border: true,
  addBtn: false,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  menu: false,
  columnBtn: false,
  index: true,
  indexLabel: '序号',
  refreshBtn: false,
  column: [
    {
      label: '产品序列号',
      prop: 'productSn'
    },
    {
      label: '不良现象',
      prop: 'ngPhenomenon'
    },
    {
      label: '不良原因大类',
      prop: 'mainNgCauseName'
    }
  ]
};
export { phenomenaOption, reasonOption, tableOption, detailOption };
